home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1996 #15
/
Monster Media Number 15 (Monster Media)(July 1996).ISO
/
prog_d
/
isamexpt.zip
/
WNTISAM1.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1996-04-05
|
14KB
|
485 lines
{HISTORY of Changes:
18.01.1996 Property NAME of ISAMBROWSER changed form ISAMBROWSER1 to RECORDNAME+BROWSER1
}
unit Wntisam1;
interface
Uses Classes, Forms, Graphics;
Function Erzeuge_BrowserForm(const FormIdent, TblName: string;
IniDatNam,IniBrwNam: String;
Fnt: TFont;
IIDList,KeyList,RecList: TStringList;
DBase_Export,DBase_Import: Boolean;
Sprache: Integer;
TblCreateBttn, SetupBttnCheck: Boolean): TForm;
implementation
Uses UToolDll, WinTypes, WinProcs, SysUtils,
ExtCtrls, Buttons, Controls, IsamTabl, IsamNav, IsamBrow,
Proxies, IStreams, FvcBrows;
Function Erzeuge_BrowserForm(const FormIdent, TblName: string;
IniDatNam,IniBrwNam: String;
Fnt: TFont;
IIDList,KeyList,RecList: TStringList;
DBase_Export,DBase_Import: Boolean;
Sprache: Integer;
TblCreateBttn, SetupBttnCheck: Boolean): TForm;
var
BtnPos : TPoint;
EdMethod,Method: TMethod;
MP,UP,Up1,Up2,Up3: TPanel;
SP : TSpeedButton;
Tbl : TIsamTable;
Tm : TTimer;
i,k : Integer;
ND : TIsamNavigator;
Grd : TIsamBrowser;
Hdr : THeader;
x : Integer;
RStr,NStr,xStr,RNam : String;
Liste1,Liste2,Liste3: TStringList;
begin
Result := TProxyForm.CreateAs('T' + FormIdent);
with Result do begin
BorderStyle := bsDialog;
AutoScroll := True;
Left := 92;
Top := 97;
Width := 562;
Height:= 352;
Position := poScreenCenter;
Name := FormIdent;
Caption := 'Browser';
Method.Code := TProxyForm(Result).CreateMethod('FormCreate');
Method.Data := Result;
OnCreate := TNotifyEvent(Method);
Method.Code := TProxyForm(Result).CreateMethod('FormDestroy');
Method.Data := Result;
OnDestroy := TNotifyEvent(Method);
Method.Code := TProxyForm(Result).CreateMethod('FormShow');
Method.Data := Result;
OnShow := TNotifyEvent(Method);
with Font do begin
Color := clBlack;
Height:= -11;
Name := 'Arial';
Size := 8;
Style:= [fsBold];
end;
MP:= TPanel.Create(Result);
with MP do begin
Parent := Result;
Name := 'Panel1';
Left := 0;
Top := 0;
Width := 554;
Height := 41;
Align := alTop;
ParentShowHint:= False;
ShowHint := True;
TabOrder := 1;
Caption:= '';
end;
Tm:= TTimer.Create(Result);
With Tm do begin
Interval:= 1000;
Name:= FormIdent+'Timer';
Method.Code := TProxyForm(Result).CreateMethod(FormIdent+'TimerTimer');
Method.Data := Result;
Tm.OnTimer := TNotifyEvent(Method);
end;
Hdr:= THeader.Create(Result);
with Hdr do begin
Parent:= Result;
Name:= 'HEADER1';
Left:= 0;
Top:= 41;
Height:= 25;
Width:= 554;
Method.Code := TProxyForm(Result).CreateMethod('Header1Sized');
Method.Data := Result;
OnSized:= TSectionEvent(Method);
end;
Tbl:= TIsamTable.Create(Result);
with Tbl do begin
Name:= FormIdent+'TABLE';
TableName:= TblName;
BrowserName:= 'IsamBrowser1';
HeaderName:= 'HEADER1';
Ansiconvert:= True;
Liste1:= TStringList.Create;
{IIDProc.Clear;}
x:= 0;
While x < IIDList.Count do begin
Liste1.Add(IIDList[x]);
Inc(x);
end;
MaxKeys:= x;
IIDProc:= Liste1;
Liste1.Free;
Liste2:= TStringList.Create;
{IsamRecord.Clear;}
RecordName:= '';
x:= 0;
While x < RecList.Count do begin
Liste2.Add(RecList[x]);
RStr:= Uppercase(RecList[x]);
Strip(RStr);
if Pos('=RECORD',RStr) > 0 then RecordName:= Copy(RStr,1,Pos('=RECORD',RStr)-1);
inc(x);
end;
RNam:= RecordName;
IsamRecord:= Liste2;
Liste2.Free;
{IsamKeyProc.Clear;}
Liste3:= TStringList.Create;
K:= 0;
if KeyList.Count > 0 then begin
Liste3.Add('Function '+RNam+'KeyProc(Var Daten; KeyNr:Word): IsamKeyStr;');
Liste3.Add('var s : String;');
Liste3.Add('begin');
Liste3.Add(' s:= '+Chr(39)+Chr(39)+';');
Liste3.Add(' With '+RNam+'(Daten) do begin');
Liste3.Add(' case KeyNr of');
For x:= 0 to KeyList.Count-1 do begin
NStr:= KeyList[x];
NStr:= UpperCase(NStr);
if Pos(';',NStr) = 0 then KeyList[x]:= KeyList[x]+';';
Strip(NStr);
if (Pos('KEYBEGIN',NStr) = 0) and (Pos('KEYEND',NStr) = 0) then begin
inc(K);
Str(k,xStr);
Liste3.Add(xStr+': '+KeyList[x]);
end;
end;
Liste3.Add(' end;');
Liste3.Add(' end;');
Liste3.Add(' '+RNam+'KEYPROC:= S;');
Liste3.Add('end;');
end;
IsamKeyProc:= Liste3;
Liste3.Free;
MyUnitName:= FormIdent;
end;
Grd:= TIsamBrowser.Create(Result);
with Grd do begin
Parent := Result;
Name := RNam+'Browser1';
Left := 0;
Top := 66;
Width := 554;
Height := 232;
Align := alNone;
JustRightChar := '░';
JustLeftChar := '|';
JustCenterChar := '~';
Color := clSilver;
BrowserHeader := Hdr;
Table := Tbl;
Font.Color := Fnt.Color;
Font.Height := Fnt.Height;
Font.Name := Fnt.Name;
Font.Style := Fnt.Style;
ParentFont := False;
TabOrder := 2;
EdMethod.Code := TProxyForm(Result).CreateMethod('EditBttnClick');
EdMethod.Data := Result;
Grd.OnDblClick := TNotifyEvent(EdMethod);
Method.Code:= TProxyForm(Result).CreateMethod(RNam+'Browser1BuildRow');
Method.Data:= Result;
Grd.OnBuildRow:= TBuildRowEvent(Method);
end;
ND:= TIsamNavigator.Create(Result);
with ND do begin
Parent:= MP;
Browser:= Grd;
Name:= 'IsamNavigator1';
ConfirmDelete:= False;
Left:= 8;
Top:= 8;
VisibleButtons:= [nbFirst,nbPrior,nbNext,nbLast];
Width:= 100;
end;
Sp:= TSpeedButton.Create(Result);
with SP do begin
Parent:= MP;
Left:= 128;
Top := 8;
Width := 25;
Height := 25;
if Sprache = 1 then Hint:= 'New record'
else Hint := 'Neuer Datensatz';
Name := 'NeuBttn';
Glyph.Handle:= LoadBitmap(HInstance,'IS_NEU');
Method.Code := TProxyForm(Result).CreateMethod('NeuBttnClick');
Method.Data := Result;
Sp.OnClick := TNotifyEvent(Method);
end;
Sp:= TSpeedButton.Create(Result);
with SP do begin
Parent:= MP;
Left:= 156;
Top := 8;
Width := 25;
Height := 25;
if Sprache = 1 then Hint:= 'Edit record'
else Hint := 'Datensatz bearbeiten';
Name := 'EditBttn';
Glyph.Handle:= LoadBitmap(HInstance,'IS_AENDERN');
Sp.OnClick := TNotifyEvent(EdMethod);
end;
Sp:= TSpeedButton.Create(Result);
with SP do begin
Parent:= MP;
Left:= 184;
Top := 8;
Width := 25;
Height := 25;
if Sprache = 1 then Hint:= 'Search'
else Hint := 'Suchen';
Name := 'SuchBttn';
Glyph.Handle:= LoadBitmap(HInstance,'IS_SUCH');
Method.Code := TProxyForm(Result).CreateMethod('SuchBttnClick');
Method.Data := Result;
Sp.OnClick := TNotifyEvent(Method);
end;
Sp:= TSpeedButton.Create(Result);
with SP do begin
Parent:= MP;
Left:= 212;
Top := 8;
Width := 25;
Height := 25;
if Sprache = 1 then Hint:= 'sort-order'
else Hint := 'Sortierordnung';
Name := 'KeyBttn';
Glyph.Handle:= LoadBitmap(HInstance,'IS_KEY');
Method.Code := TProxyForm(Result).CreateMethod('KeyBttnClick');
Method.Data := Result;
Sp.OnClick := TNotifyEvent(Method);
end;
Sp:= TSpeedButton.Create(Result);
with SP do begin
Parent:= MP;
Left:= 240;
Top := 8;
Width := 25;
Height := 25;
if Sprache = 1 then Hint:= 'Delete'
else Hint := 'L÷schen';
Name := 'LoeschBttn';
Glyph.Handle:= LoadBitmap(HInstance,'IS_LOESCHEN');
Method.Code := TProxyForm(Result).CreateMethod('LoeschBttnClick');
Method.Data := Result;
Sp.OnClick := TNotifyEvent(Method);
end;
Sp:= TSpeedButton.Create(Result);
with SP do begin
Parent:= MP;
Left:= 268;
Top := 8;
Width := 25;
Height := 25;
if Sprache = 1 then Hint:= 'Reorganize table'
else Hint := 'Tabelle reorganisieren';
Name := 'ReorgBttn';
Glyph.Handle:= LoadBitmap(HInstance,'IS_REORG');
Method.Code := TProxyForm(Result).CreateMethod('ReorgBttnClick');
Method.Data := Result;
Sp.OnClick := TNotifyEvent(Method);
end;
Sp:= TSpeedButton.Create(Result);
with SP do begin
Parent:= MP;
Left:= 296;
Top := 8;
Width := 25;
Height := 25;
if Sprache = 1 then Hint:= 'Setup browser'
else Hint := 'Browser einstellen';
Name := 'BrwBttn';
Glyph.Handle:= LoadBitmap(HInstance,'IS_BRWSETUP');
Method.Code := TProxyForm(Result).CreateMethod('BrwBttnClick');
Method.Data := Result;
Sp.OnClick := TNotifyEvent(Method);
end;
if DBase_Export then begin
Sp:= TSpeedButton.Create(Result);
with SP do begin
Parent:= MP;
Left:= 324;
Top := 8;
Width := 25;
Height := 25;
Hint := 'DBase-Export';
Name := 'DBExpBttn';
Glyph.Handle:= LoadBitmap(HInstance,'IS_DBEXPORT');
NumGlyphs:= 2;
Method.Code := TProxyForm(Result).CreateMethod('DBExpBttnClick');
Method.Data := Result;
Sp.OnClick := TNotifyEvent(Method);
end;
end;
if DBASE_Import then begin
Sp:= TSpeedButton.Create(Result);
with SP do begin
Parent:= MP;
if DBase_Export then Left:= 352 else Left:= 324;
Top := 8;
Width := 25;
Height := 25;
Hint := 'DBase-Import';
Name := 'DBImpBttn';
Glyph.Handle:= LoadBitmap(HInstance,'IS_DBIMPORT');
NumGlyphs:= 2;
Method.Code := TProxyForm(Result).CreateMethod('DBImpBttnClick');
Method.Data := Result;
Sp.OnClick := TNotifyEvent(Method);
end;
end;
if TblCreateBttn then begin
Sp:= TSpeedButton.Create(Result);
with SP do begin
Parent:= MP;
Left:= 324;
if DBase_Export then Left:= Left + 28;
if DBase_Import then Left:= Left + 28;
Top := 8;
Width := 25;
Height := 25;
if Sprache = 1 then Hint := 'Create Table'
else Hint:= 'Tabelle erzeugen';
Name := 'CreateBttn';
Glyph.Handle:= LoadBitmap(HInstance,'IS_CREATE');
NumGlyphs:= 2;
Method.Code := TProxyForm(Result).CreateMethod('CreateBttnClick');
Method.Data := Result;
Sp.OnClick := TNotifyEvent(Method);
end;
end;
if SetupBttnCheck then begin
Sp:= TSpeedButton.Create(Result);
with SP do begin
Parent:= MP;
Left:= 324;
if DBase_Export then Left:= Left + 28;
if DBase_Import then Left:= Left + 28;
if TblCreateBttn then Left:= Left + 28;
Top := 8;
Width := 25;
Height := 25;
Hint := 'Setup';
Name := 'SetupBttn';
NumGlyphs:= 2;
Glyph.Handle:= LoadBitmap(HInstance,'IS_DATSETUP');
Method.Code := TProxyForm(Result).CreateMethod('SetupBttnClick');
Method.Data := Result;
Sp.OnClick := TNotifyEvent(Method);
end;
end;
Sp:= TSpeedButton.Create(Result);
with SP do begin
Parent:= MP;
Left:= 520;
Top := 8;
Width := 25;
Height := 25;
if Sprache = 1 then Hint:= 'End'
else Hint := 'Ende';
Name := 'ExitBttn';
Glyph.Handle:= LoadBitmap(HInstance,'IS_ENDE');
Method.Code := TProxyForm(Result).CreateMethod('ExitBttnClick');
Method.Data := Result;
Sp.OnClick := TNotifyEvent(Method);
end;
UP:= TPanel.Create(Result);
with UP do begin
Parent := Result;
Name := 'Panel2';
Align := alBottom;
BevelInner:= bvLowered;
Height:= 27;
ShowHint:= False;
Caption:= '';
end;
UP1:= TPanel.Create(Result);
With UP1 do begin
Parent:= UP;
Left := 308;
Top := 2;
Width := 108;
Height:= 23;
Align := alRight;
BevelOuter := bvLowered;
Font.Color := clBlack;
Font.Height := -11;
Font.Name := 'Arial';
Font.Style := [];
Name:= 'ZeitPanel';
Caption:= '';
end;
UP2:= TPanel.Create(Result);
With UP2 do begin
Parent:= UP;
Left := 2;
Top := 2;
Width := 127;
Height:= 23;
Align := alLeft;
Alignment:= taLeftJustify;
BevelOuter := bvLowered;
Font.Color := clBlack;
Font.Height := -11;
Font.Name := 'Arial';
Font.Style := [];
Name:= 'KeyPanel';
Caption:= 'Key';
end;
UP3:= TPanel.Create(Result);
with UP3 do begin
Parent:= UP;
Left := 2;
Top := 2;
Width := 186;
Height:= 23;
Align := alClient;
ShowHint:= True;
BevelInner := bvLowered;
BevelOuter := bvNone;
Font.Color := clBlack;
Font.Height := -11;
Font.Name := 'Arial';
Font.Style := [];
Name:= 'Statusbar';
Caption:= '';
end;
end;
end;
end.